import { getDbLow } from '../_api/index.js'

export default {
  namespaced: true,
  
  state: {
    dbLowList: [
      {
        bond_nm: '华阳',
        bond_id: 123,
        full_price: '100.0', // 现价
        increase_rt: '3.68', // 涨跌幅
        convert_value: '133', // 转股价值
        premium_rt: '-23.16', // 溢价率
        dblow: '356', // 双低值
        hasStock: false // 是否已持仓
      }
    ],
    
    queryInfo: {
      tprice: 120, // 现价低于这个值
      premium_rt: 10, // 溢价率
      curr_iss_amt: 10 // 剩余规模小于
    }
  },
  
  mutations: {
    SET_DBLOW_LIST (state, dataList) {
      state.dbLowList = dataList
    }
  },
  
  actions: {
    
    getDbLowReq: ({commit, state}) => {
      getDbLow(state.queryInfo)
        .then(res => {
          commit('SET_DBLOW_LIST', res.data)
        })
        .catch(_ => {})
    }
    
  }
}